﻿using System.Windows.Controls;

namespace GlobalizationTools.ViewModel
{
    /// <summary>
    /// Interaction logic for MultiResourceViewer.xaml
    /// </summary>
    public partial class MultiResourceViewer : UserControl
    {
        public MultiResourceViewer()
        {
            InitializeComponent();
        }

        private void grid_InitializingNewItem(object sender, InitializingNewItemEventArgs e)
        {
            TabControlItemViewModel model = (TabControlItemViewModel)this.DataContext;
            ResourceEntry entry = (ResourceEntry)e.NewItem;
            int count = grid.Columns.Count;
            while (entry.Values.Count < count) {
                entry.Values.Add(new ResourceData(model));
            }
            model.IsModified = true;
        }

        private void SelectedType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SelectedType.GetBindingExpression(ComboBox.SelectedIndexProperty).UpdateTarget();
        }


    }
}
